package com.example.midushop.service.product.impl;

import com.example.midushop.entity.product.spu.ProductSPU_image;
import com.example.midushop.mapper.product.spu.ProductSPU_imageMapper;
import com.example.midushop.service.product.SPUImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商品SPU图片集合服务接口实现类
 */
@Service
public class SPUImageServiceImpl implements SPUImageService {
    @Autowired
    ProductSPU_imageMapper productSPU_imageMapper;

    /**
     * 添加商品SPU图片集合
     * @param spu_id SPUID
     * @param image 图片名称
     * @param sort 排序
     * @return 返回受影响行数
     */
    @Override
    public int addSPUImage(long spu_id, String image, int sort) {
        return productSPU_imageMapper.addSPUImage(spu_id,image,sort);
    }

    /**
     * 根据商品SPUID以及图片ID查询图片集
     * @param spu_id 商品SPUID
     * @param id    图片id
     * @return 返回结果集
     */
    @Override
    public List<ProductSPU_image> findProductSPU_image(long spu_id, long id) {
        return productSPU_imageMapper.findProductSPU_image(spu_id,id);
    }
}
